<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改页</title>
</head>
<body>
<form method="post" action="studentServlet">
    学号：<input type="text" id="studentNo" name="studentNo"><br/>
    姓名：<input type="text" id="studentName" name="studentName"><br/>
    性别：男：<input type="radio" id="male" name="sex" value="男">女：<input id="female" type="radio" name="sex" value="女"><br/>
    出身日期：<input id="bornDate" type="datetime-local" step="01" name="bornDate"><br>
    <input type="hidden" name="opr" value="updateStu">
    <input type="submit" value="提交">
</form>

<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="js/util.js"></script>
<script type="text/javascript">
    $(function () {
        function initStu() {
            var studentNo = GetQueryString("studentNo");
            $.getJSON("studentServlet", "studentNo=" + studentNo + "&opr=select", successSel)

            function successSel(data) {
                $("#studentNo").val(data.studentNo);
                $("#studentName").val(data.studentName);

                $("#bornDate").val(data.bornDate);
                if (data.sex == "男") {
                    console.log("男==");
                    $("#male").attr("checked", "checked");
                } else {
                    console.log("nv==");
                    $("#female").attr("checked", "checked");
                }
            }

        }

        initStu();
    });
</script>
</body>
</html>